package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    /**
     * 员工职位统计
     *
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }
    /*@GetMapping("/empJobData")
    public Result getEmpJobData() {
        Map<String, List> mapList = reportService.getEmpJobData();
        return Result.success(mapList);
    }*/


    /**
     * 按员工性别统计数量
     *
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map<String, Object>> dataList = reportService.getEmpGenderData();
        return Result.success(dataList);
    }


    /**
     * 班级人数统计
     *
     * @return
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        StudentOption studentOption = reportService.getStudentCountData();
        return Result.success(studentOption);
    }


    /**
     * 学员学历统计
     *
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        List<Map<String, Object>> mapList = reportService.getStudentDegreeData();
        return Result.success(mapList);
    }
}
